home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1993 April: Penguin on DISC / ADC Developer CD (1993-04) (''Penguin On DISC'')_iso / Dev.CD Apr 93.iso / Utilities / MPW Interfaces 7.1 Beta / CIncludes / Dictionary.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-08-28  |  3.3 KB  |  128 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        Dictionary.h
  3.  
  4.     Written by:    Hae-Sung Kim
  5.  
  6.     Copyright:    © 1992 by Apple Computer, Inc., all rights reserved.
  7.  
  8.  
  9. */
  10.  
  11. #ifndef __DICTIONARY__
  12. #define __DICTIONARY__
  13.  
  14. #ifndef __TYPES__
  15. #include <Types.h>
  16. #endif
  17.  
  18. #ifndef __FILES__
  19. #include <Files.h>
  20. #endif
  21.  
  22. /*------------------------------------------------------------------------------------------
  23.     Constant definitions.
  24. ------------------------------------------------------------------------------------------ */
  25.  
  26. /* Dictionary data insertion modes. */
  27.  
  28. enum {
  29.  kInsert = 0,            /* Only insert the input entry if there is nothing in the dictionary that matches the key. */
  30.  kReplace = 1,            /* Only replace the entries which match the key with the input entry. */
  31.  kInsertOrReplace = 2    /* Insert the entry if there is nothing in the dictionary which matches the key. */
  32.                         /* If there is already matched entries, replace the existing matched entries with the input entry. */
  33. };
  34. typedef short InsertMode;
  35.  
  36. /* Key attribute constants.        */
  37.  
  38. #define        kIsCaseSensitive            0x10        /* case sensitive = 16        */
  39. #define        kIsNotDiacriticalSensitive    0x20        /* diac not sensitive = 32    */
  40.  
  41. /* Registered attribute type constants.    */
  42.  
  43. enum {
  44.  kNoun        =    -1,
  45.  kVerb        =    -2,
  46.  kAdjective    =    -3,
  47.  kAdverb    =    -4
  48. };
  49. typedef short AttributeType;
  50.  
  51. /* ------------------------------------------------------------------------------------------
  52.  
  53.     Type definitions.
  54.  
  55. ------------------------------------------------------------------------------------------ */
  56.  
  57. /* Dictionary information record.    */
  58.  
  59. struct DictionaryInformation{
  60.     FSSpec            dictionaryFSSpec;
  61.     long            numberOfRecords;
  62.     long            currentGarbageSize;
  63.     ScriptCode        script;    
  64.     short            maximumKeyLength;
  65.     unsigned char    keyAttributes;
  66. };
  67.  
  68. typedef struct DictionaryInformation DictionaryInformation;
  69.  
  70.  
  71.  
  72. /* --------------------------------------------------------------------------------------
  73.  
  74.     Function ProtoTypes.
  75.  
  76. -------------------------------------------------------------------------------------- */
  77.  
  78. #ifdef __cplusplus
  79. extern "C" {
  80. #endif
  81.  
  82. pascal OSErr InitializeDictionary(FSSpecPtr theFsspecPtr, short maximumKeyLength, 
  83.  unsigned char keyAttributes, ScriptCode script )
  84. = { 0x303C,0x0500,0xAA53 };
  85.  
  86. pascal OSErr OpenDictionary( FSSpecPtr theFsspecPtr,
  87.  char accessPermission,
  88.  long *dictionaryReference )
  89. = { 0x303C,0x0501,0xAA53 };
  90.  
  91. pascal OSErr CloseDictionary( long dictionaryReference )
  92. = { 0x303C,0x0202,0xAA53 };
  93.  
  94. pascal OSErr InsertRecordToDictionary( long dictionaryReference, 
  95.  ConstStr255Param key, 
  96.  Handle recordDataHandle, 
  97.  InsertMode whichMode )
  98. = { 0x303C,0x0703,0xAA53 };
  99.  
  100. pascal OSErr DeleteRecordFromDictionary( long dictionaryReference, 
  101.  ConstStr255Param key )
  102. = { 0x303C,0x0404,0xAA53 };
  103.  
  104. pascal OSErr FindRecordInDictionary( long dictionaryReference, 
  105.  ConstStr255Param key, 
  106.  Ptr requestedAttributeTablePointer, 
  107.  Handle recordDataHandle )
  108. = { 0x303C,0x0805,0xAA53 };
  109.  
  110. pascal OSErr FindRecordByIndexInDictionary( long dictionaryReference, 
  111.  long recordIndex, 
  112.  Ptr requestedAttributeTablePointer, 
  113.  Str255 recordKey,
  114.  Handle recordDataHandle )
  115. = { 0x303C,0x0A06,0xAA53 };
  116.  
  117. pascal OSErr GetDictionaryInformation( long dictionaryReference,
  118.  DictionaryInformation *theDictionaryInformation)
  119. = { 0x303C,0x0407,0xAA53 };
  120.  
  121. pascal OSErr CompactDictionary( long dictionaryReference )
  122. = { 0x303C,0x0208,0xAA53 };
  123.  
  124. #ifdef __cplusplus
  125. }
  126. #endif
  127.  
  128. #endif __Dictionary__